<template>
	<view class="news">
		<news-Item :list="newsList" @itemClick="goDetail"></news-Item>
	</view>
</template>

<script>
	import newsItem from '@/components/news_item/news_item.vue'
	export default{
		data(){
			return{
				newsList:[]
			}
		},
		components:{
			newsItem
		},
		onLoad(){
			this.getNews();
		},
		methods:{
			async getNews(){
				const res = await this.$myRequest({
					url:"/api/getnewslist"
				});
				console.log(res);
				this.newsList = res.data.message;
			},
			goDetail(item){
				console.log(JSON.stringify(item))
				uni.navigateTo({
					url:"/pages/news_detail/news_detail?id="+item.id
				})
			}
		}
		
	}
</script>

<style>
	
</style>